
#ifndef TRACKER
#define TRACKER

#include <sys/types.h>
#include <sys/signal.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <sys/errno.h>
#include <netinet/in.h>
#include <netdb.h>
#include <pthread.h>

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#define NO_OF_PARTS 1000
#define MAX_SEEDS 5
#define MAX_LEECHES 5
#define MAX_PEERS 20         // total peers in swarm

#define TRACKER_PORT 7001
#define BUF_SIZE 128
#define NUMBER_OF_THREADS 10
#define IPv4_SIZE 20 // some extra size included

//void append_file_part(struct node **,char *, int , int ,int, char *);
//void Update(struct node **,char *, int , int ,int);
//void append_list ( struct node **, char * );

/****************************************Data Structures ***********************************/

struct node
	{
	 char value[BUF_SIZE];
	 struct node *next;
     struct file_part *node_part;

	};

struct seeder{
	int seeder_id;
	struct sockaddr_in sd_sin;//  struct sockaddr_in6 sd_sin ( for IPV6)
};

struct leecher{
	int leecher_id;
	struct sockaddr_in lc_sin;//  struct sockaddr_in6 lc_sin ( for IPV6)
};

struct file_part{

        struct file_part *next;
        int part_num;	
     	struct seeder seeder_list[MAX_SEEDS]  ;     //list of seeders.
	    struct leecher leecher_list[MAX_LEECHES] ; //list of leechers.
	    //float percent_downloaded;
	    //enum status{SEEDING,COMPLETE,LEECHING,PENDING}download;
		
};

/**********************Function Declarations****************************/

void * communicate(void *);

struct thread_data
{
   int	ssocket;
   struct sockaddr_in client_sin;
};

struct thread_data thread_data_array[NUMBER_OF_THREADS];


#endif
